package cn.db.controller;

import cn.db.service.UserInfoService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @GetMapping("send")
    public String send(){
        String name="远程调用provider";
        return name;
    }

    @GetMapping("/getUserInfo")
    public String getUserInfo(@RequestParam("userId")long userId){
     return JSONObject.toJSONString(userInfoService.getUserInfo(userId)) ;
    }


    @GetMapping("/getUserMoney")
    public String getUserMoney(@RequestParam("userId")long userId){
        return JSONObject.toJSONString(userInfoService.getUserMoney(userId)) ;
    }
}
